package com.qf.service.impl;

import com.qf.model.entity.ReserveRegister;
import com.qf.dao.ReserveRegisterDao;
import com.qf.model.vo.ReserveRegisterVO;
import com.qf.service.ReserveRegisterService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;

/**
 * (ReserveRegister)表服务实现类
 *
 * @author makejava
 * @since 2024-05-05 14:41:49
 */
@Service("reserveRegisterService")
public class ReserveRegisterServiceImpl implements ReserveRegisterService {
    @Autowired
    private ReserveRegisterDao reserveRegisterDao;

    /**
     * 通过ID查询单条数据
     *
     * @param resId 主键
     * @return 实例对象
     */
    @Override
    public ReserveRegister queryById(Long resId) {
        return this.reserveRegisterDao.queryById(resId);
    }

    /**
     * 分页查询
     *
     * @return 查询结果
     */
    @Override
    public List<ReserveRegister> queryByPage(Long pageNum) {
        return this.reserveRegisterDao.queryAllByLimit();
    }

    @Override
    public List<ReserveRegisterVO> selectRegisterWithPatientByCondition(Map<String, Object> map) {
        return reserveRegisterDao.selectRegisterWithPatientByCondition(map);
    }

    /**
     * 新增数据
     *
     * @param reserveRegister 实例对象
     * @return 实例对象
     */
    @Override
    public ReserveRegister insert(ReserveRegister reserveRegister) {
        this.reserveRegisterDao.insert(reserveRegister);
        return reserveRegister;
    }

    /**
     * 修改数据
     *
     * @param reserveRegister 实例对象
     * @return 实例对象
     */
    @Override
    public ReserveRegister update(ReserveRegister reserveRegister) {
        this.reserveRegisterDao.update(reserveRegister);
        return this.queryById(reserveRegister.getResId());
    }

    /**
     * 通过主键删除数据
     *
     * @param resId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long resId) {
        return this.reserveRegisterDao.deleteById(resId) > 0;
    }
}
